package com.xuecheng.teaching.agent.hystrix;


import com.xuecheng.api.comment.model.*;
import com.xuecheng.api.comment.model.dto.CommentDTO;
import com.xuecheng.api.comment.model.dto.ReplyDTO;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.common.domain.response.RestResponse;
import com.xuecheng.common.hystrix.BaseAPIHystrix;
import com.xuecheng.common.hystrix.BaseFallbackFactory;
import com.xuecheng.teaching.agent.CommentApiAgent;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * Created on 2021/04/05/19:53 周一
 *
 * @author Lantin
 */

@Component
public class CommentApiAgentFallbackFactory extends BaseFallbackFactory<
        BaseAPIHystrix<Object>,
        CommentApiAgentFallbackFactory.CommentApiAgentHystrix,
        CommentApiAgentFallbackFactory.DevCommentApiAgentHystrix> {

    /**
     * <p>
     * 生产环境降级方法类
     * </p>
     * 返回
     */
    public static class CommentApiAgentHystrix extends BaseAPIHystrix<Object> implements CommentApiAgent {


        public CommentApiAgentHystrix(Throwable throwable) {
            super(throwable);
        }

        @Override
        public RestResponse<CommentDTO> createComment(CommentModel model) {
            return null;
        }

        @Override
        public RestResponse<PageVO<CommentDTO>> querryCommentList(QuerryCommentModel querryCommentModel) {
            return null;
        }

        @Override
        public RestResponse<CommentStaticsModel> commentStatistics(Long targetId) {
            return null;
        }

        @Override
        public RestResponse<Boolean> praiseComment(Long commentId, String userName) {
            return null;
        }

        @Override
        public RestResponse<PageVO> querryOrgCommentList(QuerryCommentModel model) {
            return null;
        }

        @Override
        public RestResponse<ReplyDTO> commentReply(ReplyModel model) {
            return null;
        }

        @Override
        public RestResponse<Boolean> deleteCommentById(Long commentId) {
            return null;
        }

        @Override
        public RestResponse<Boolean> deleteComments(String[] commentIds) {
            return null;
        }

        @Override
        public RestResponse<PageVO> querryOrgAllCommentList(QuerryCommentModel model) {
            return null;
        }
    }

    /**
     * <p>
     * 开发环境降级方法类
     * </p>
     * 返回一个默认值
     */
    public static class DevCommentApiAgentHystrix extends BaseAPIHystrix<Object> implements CommentApiAgent {

        public DevCommentApiAgentHystrix(Throwable throwable) {
            super(throwable);
        }

        @Override
        public RestResponse<CommentDTO> createComment(CommentModel model) {
            return RestResponse.success(new CommentDTO());
        }

        @Override
        public RestResponse<PageVO<CommentDTO>> querryCommentList(QuerryCommentModel querryCommentModel) {
            return RestResponse.success(new PageVO());
        }

        @Override
        public RestResponse<CommentStaticsModel> commentStatistics(Long targetId) {
            return RestResponse.success(new CommentStaticsModel());
        }

        @Override
        public RestResponse<Boolean> praiseComment(Long commentId, String userName) {
            return RestResponse.success(true);
        }

        @Override
        public RestResponse<PageVO> querryOrgCommentList(QuerryCommentModel model) {
            return RestResponse.success(new PageVO());
        }

        @Override
        public RestResponse<ReplyDTO> commentReply(ReplyModel model) {
            return RestResponse.success(new ReplyDTO());
        }

        @Override
        public RestResponse<Boolean> deleteCommentById(Long commentId) {
            return RestResponse.success(true);
        }

        @Override
        public RestResponse<Boolean> deleteComments(String[] commentIds) {
            return RestResponse.success(true);
        }

        @Override
        public RestResponse<PageVO> querryOrgAllCommentList(QuerryCommentModel model) {
            return RestResponse.success(new PageVO());
        }
    }

}
